import { Injectable } from '@nestjs/common';
import * as Captcha from 'svg-captcha';

@Injectable()
export class CodeService {
  getCode(session) {
    const captcha = Captcha.create({
      size: 4,
      fontSize: 24,
      width: 140,
      height: 32,
      background: '#cc9966',
    });
    session.code = captcha.text;
    return { body: captcha.data };
  }
}
